<link href="admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<{$config.weburl}>/script/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="<{$config.weburl}>/script/jquery.ui.js"></script>
<div class="container">
<div class="oflow" style="height:545px">
<form name="form1" id="form1" action="module.php?m=product&s=order_opear.php" method="post">
<input name="id" type="hidden" id="id" value="<{$de.order_id}>">
<input type="hidden" name="money" value="<{$de.cost}>" />
<table class="table">
    <thead>
        <tr>
            <th class="partition" colspan="99">订单详情</th>
        </tr>
    </thead>
    <tbody>
    <tr class="tr">
        <td width="50">订单状态</td>
        <td width="100"><b class="org"><{$de.statu_text}></b></td>
    
        <td width="50">订单编号</td>
        <td width="150"><{$de.order_id}></td>
        
        <td width="50">下单时间</td>
        <td><{$de.create_time|date_format:"%Y-%m-%d&nbsp;%H:%M:%S"}></td>
    </tr>
    <tr class="tr">
        <td>支付状态</td>
        <td><{$de.order_ship_status}></td>
  <{if $de.shipping_id ==0}>
                <{if !empty($de.pick_name)}>
 <td>配送方式</td>
        <td>上门自取</td>
         <{/if}>
         <{else}>
         <td>配送方式</td>
        <td ><{$de.shipping_name}></td>
 <{/if}>
        <td>配送状态</td>
        <td colspan="2"><{$de.order_pay_status}></td>


    </tr>
    </tbody>
</table>
<table class="table product">    
    <thead>
        <tr>
            <th class="partition" colspan="99">订单信息</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <!--<td class="al">编号</td>-->
            <td class="al">产品</td>
            <td width="90">场馆</td>
            <td width="90">座位</td>
            <td width="90">演出日期</td>
            <td width="90">单价</td>
            <td width="90">数量</td>
            <td width="90">总价</td>
        </tr>
        <{foreach item=list from=$de.product}>
        <tr>
            <!--<td class="al"><{$list.code}></td>-->
            <td class="al <{if $list.service}>npb<{/if}>">
                <a target="_blank" href="../?m=product&s=detail&id=<{$list.pid}>">
                    <{$list.name}>
                </a>
            </td>
            <td>
                <{$list.spot_id|get_spot_name}>
            </td>
            <td>
                <{if !empty($list.spot_model_id)}>
                <{foreach item=vo from=$list.spot_model_id key=k}>
                <{$vo|get_spot_model_name}><{$list.seat_seat_row[$k]}>排<{$list.seat_seat_cols[$k]}>座<br/>
                <{/foreach}>
                <{else}>
                择优分配
                <{/if}>
            </td>
            <td><{$list.per_date|date_format:"%Y-%m-%d"}></td>
            <td <{if $list.service}>class="npb"<{/if}>><{$config.money}><{$list.price|number_format:2}></td>
            <td <{if $list.service}>rowspan="2"<{/if}>><{$list.num}></td>
            <td <{if $list.service}>rowspan="2"<{/if}>><{$config.money}><{$list.sum|number_format:2}></td>
        </tr>
        <{if $list.product_give}>
        <tr class="product_give">
            <td class="al">赠品</td>
            <td class="al">
                <{foreach item=slist from=$list.product_give}>
                    <li><{$slist.pname}></li>
                <{/foreach}>
            </td>
        </tr>
        <{/if}>
        <{if $list.service}>
        <tr class="other">
            <td class="al">服务</td>
            <td class="al">
                <{foreach item=slist from=$list.service}>
                    <li><{$slist.name}></li>
                <{/foreach}>
            </td>
            <td>
                <{foreach item=slist from=$list.service}>
                    <p><{$config.money}><{$slist.price}></p>
                <{/foreach}>
            </td>
        </tr>
        <{/if}>
        <{/foreach}>
        <{if $de.des}>
        <tr>
            <td class="al" colspan="99">备注: <{$de.des}></td>
        </tr>
        <{/if}>
    </tbody>
</table>
<table class="table">
    <tbody>
    <{if $de.status==1 and $de.pay_status==1}>
    <tr>
        <td width="100">商品总金额:</td>
        <td width="200">
        <input type="text" name="cost" id="cost" disabled="disabled" value="<{$de.cost}>" />
        </td>
        <td width="100">配送方式：</td>
        <td>
            <select name="shipping_id" class="w162">
            <{foreach item=list from=$ship}>
                <option <{if $de.shipping_id==$list.id}>selected="selected"<{/if}> value="<{$list.id}>"><{$list.title}></option>
            <{/foreach}>
            </select>
        </td>
    </tr>
    <tr>
        <td>配送费用:</td>
        <td><input type="text" onblur="count()" id="freight" name="freight" value="<{$de.freight}>" /></td>


        <td>支付方式：</td>
        <td>
        <select name="payment_id" class="w162">
        <{foreach item=list from=$pay}>
            <option <{if $de.payment_id==$list.payment_id}>selected="selected"<{/if}> value="<{$list.payment_id}>"><{$list.payment_name}></option>
        <{/foreach}>
        </select>
        </td>
    </tr>
    <tr>
        <td>商品重量:</td>
        <td><input type="text" name="weight" value="<{$de.weight}>" /></td>
        <td>订单折扣或涨价：</td>
        <td>
        <input type="text" onblur="count()" name="rebate" id="rebate" value="" class="w160" oninput="javascript:inputBuynum(this);" />
        <span class="hint">输入"-100","100"</span>
        </td>
    </tr>
    <tr>
        <td>积分抵扣:</td>
        <td><input type="text"  id="cost_point" name="cost_point" value="<{$de.cost_point}>" /></td>
        <td>应付总额:</td>
        <td colspan="2"><input type="text" name="price" id="price" disabled="disabled" value="<{$de.cost+$de.freight|number_format:2}>" /></td>



    </tr>
	<{else}>
    <tr>
        <td width="100">商品总金额:</td>
        <td width="200"><{$config.money}><{$de.cost}></td>
        <td width="100">配送方式：</td>
        <td><{$de.shippind_name}></td>
    </tr>
    <tr>
        <td>配送费用:</td>
        <td><{$config.money}><{$de.freight}></td>
        <td>支付方式：</td>
        <td><{$de.payment_name}></td>
    </tr>
    <tr>
        <td>商品重量:</td>
        <td colspan="2"><{$de.weight}>kg</td>
    </tr>
    <tr>
        <td>应付总额:</td>
        <td colspan="3"><{$config.money}><{$de.cost+$de.freight}></td>
    </tr>
    <{/if}>
    </tbody>
</table>
 <{if empty($de.pick_name)}>

<table class="table">         
    <thead>
    <tr>
        <th class="partition" colspan="99">收货地址</th>
    </tr>
    </thead>
    <tbody>
    <{if $de.status==1 and $de.pay_status==1}>
    <tr>
        <td width="100">收货人</td>
        <td><input type="text" name="ship_name" class="w350" value="<{$de.ship_name}>" /></td>
    </tr>
    <tr>
        <td>联系电话</td>
        <td>
        <input type="text" name="ship_tel" class="w350" value="<{$de.ship_tel}>" />
        </td>
    </tr>
    <tr>
        <td>手机</td>
        <td>
        <input type="text" name="ship_mobile" class="w350" value="<{$de.ship_mobile}>" />
        </td>
    </tr>
    <tr>
        <td>收货地址</td>
        <td><input type="text" name="ship_addr" class="w350" value="<{$de.provinceid|getdistrictname}> <{$de.cityid|getdistrictname}> <{$de.areaid|getdistrictname}> <{$de.ship_addr}>" /></td>
    </tr>
    <{else}>
    <tr>
        <td width="100">收货人</td>
        <td><{$de.ship_name}></td>
    </tr>
    <tr>
        <td>联系电话</td>
        <td><{$de.ship_mobile}> <{$de.ship_tel}></td>
    </tr>
    <tr>
        <td>收货地址</td>
        <td><{$de.provinceid|getdistrictname}> <{$de.cityid|getdistrictname}> <{$de.areaid|getdistrictname}><{$de.ship_addr}></td>
    </tr>
    <{/if}>   
    </tbody>
</table>

<{else}>

<table class="table">         
    <thead>
    <tr>
        <th class="partition" colspan="99">取票地址</th>
    </tr>
    </thead>
    <tbody>
  
    <tr>
        <td width="100">取票人</td>
        <td><input type="text" name="pick_name" class="w350" value="<{$de.pick_name}>" /></td>
    </tr>
    <tr>
        <td>联系电话</td>
        <td>
        <input type="text" name="pick_mobile" class="w350" value="<{$de.pick_mobile}>" />
        </td>
    </tr>

    <tr>
        <td>取票地址</td>
        <td><input type="text" name="ship_addr" class="w350" value="<{$de.pick_addr}>" /></td>
    </tr>
 
    </tbody>
</table>
<{/if}>

    <{if $de.invoice_type > 0}>
<table class="table">         
    <thead>
        <tr>
            <th class="partition" colspan="99">发票信息</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td width="100">发票信息</td>
            <td>普通发票</td>
        </tr>

        <tr>
            <td>发票抬头</td>
            <td><{$de.invoice_company}></td>
        </tr>

        <tr>
            <td>寄票地址</td>
            <td><{$de.invoice_addr}></td>
        </tr>
    </tbody>
</table>
    <{/if}>


    <table class="table">
        <thead>
        <tr>
            <th class="partition" colspan="99">备注</th>
        </tr>
        </thead>
        <tbody>

        <tr>
            <td width="100">备注信息</td>
            <td>
                <textarea name="order_remark" class="w350"><{$de.order_remark}></textarea>
            </td>
        </tr>

        </tbody>
    </table>



    <div style="height: 30px;"></div>
<div class="dialog_button">
<input id="save" type="button" value="保存">
<input name="act" type="hidden" id="action" value="edit">   
</div>
<div id="error"></div> 
<script>
function count()
{
	cost=$("#cost").val();
	freight=Number($("#freight").val()).toFixed(2);;
	rebate=Number($("#rebate").val()).toFixed(2);	
	price=Number(Number(cost)+Number(freight)+Number(rebate)).toFixed(2);
	if(price>0){
		$("#price").val(price);
	}
}
function inputBuynum(ele){
	var buyNum = $(ele).val();
	var num = $("#price").val()*-1;
	if(buyNum!=null&&buyNum!=""){
		if(Number(buyNum)<Number(num)){
			alert("输入的数量有误");
			$(ele).val('0');
			count();
		}
	}
} 
function $$(id) {
	return !id ? null : document.getElementById(id);
}
function ajaxpost(formid) {
	var ajaxframeid = 'ajaxframe';
	var ajaxframe = $$(ajaxframeid);
	if(!ajaxframe){
		var div = document.createElement('div');
		div.style.display = 'none';
		div.innerHTML = '<iframe name="' + ajaxframeid + '" id="' + ajaxframeid + '" loading="1"></iframe>';
		ajaxframe = $$(ajaxframeid);
		$$('append_parent').appendChild(div);
	}
	$$(formid).target = ajaxframeid;
	$$(formid).submit();
	window.parent.main.document.location.reload();
	DialogManager.close("order");
}
$("#save").click(function () {
	ajaxpost("form1");
	return false;
});
</script>
</form>
</div>
</div>